<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">

</script>
<div class="bjui-pageContent">
	<!-- 查询和编辑公用一个页面，id空：新增，id不空：编辑--
		注意：本系统遵循restful架构，action处理时method严格按照 新增：post 编辑：put 删除:delete 查询：get(默认)
		由于删除和编辑form表单不支持，所以必须在action的url后面增加参数_method=put或_method=delete
	-->
	#if(!$!{record.id})
	<form type="post" id="tsSyUserAddForm"
		action="$!{webPath}/tssy/tsSyUser/add?navTabId=tsSyUserLiNav&closeCurrent=true"
		data-toggle="validate" data-alertmsg="false">
		#else
		<form type="post" id="tsSyUserAddForm"
			action="$!{webPath}/tssy/tsSyUser/update?_method=put&navTabId=tsSyUserLiNav&closeCurrent=true"
			data-toggle="validate" data-alertmsg="false">
			#end #if(!$!{record.id}) <input type="hidden" name="id" value="" />
			#else <input type="hidden" name="id" value="$!{record.id}" /> #end 
			<input type="hidden" name="createTime"
				value="$!dateTool.format('yyyy-MM-dd',$!record.createTime)"
				 size="15" id="j-createTime" /> <input
				type="hidden" name="createBy" value="$!record.createBy" size="15"
				id="j-createBy" /> <input type="hidden" name="updateTime"
				value="$!dateTool.format('yyyy-MM-dd',$!record.updateTime)"
				 size="15" id="j-updateTime" /> <input
				type="hidden" name="updateBy" value="$!record.updateBy" size="15"
				id="j-updateBy" />
				<input type="hidden"
							name="deptId" value="$!record.deptId" size="15" id="deptId" />
			<table class="table table-condensed table-hover" width="100%">
				<tbody>
					<tr>
						<td><label for="j-realName" class="control-label x85">姓名：</label> <input type="text"
							name="realName" value="$!record.realName" size="15"  maxlength="30"
							id="j-realName" /></td>
						<td><label class="control-label x85">性别：</label> <input type="radio" name="sex" data-toggle="icheck"
							opertion="EqualTo" value="M" #if($!record.sex&&$record.sex==
							'M')checked#end id="jw-msex" class="form-control" /><label
							for="jw-msex">&nbsp;男</label> <input type="radio" name="sex" data-toggle="icheck"
							opertion="EqualTo" value="F" #if($!record.sex&&$record.sex==
							'F')checked#end id="jw-gsex" class="form-control" /><label
							for="jw-gsex">&nbsp;女</label></td>
					</tr>
					<tr>
						<td><label for="j-loginName" class="control-label x85">登录名：</label>
						 <input type="text"
							name="loginName" value="$!record.loginName" size="15"  maxlength="30"
							id="j-loginName" #if($!{record.id})readonly="readonly"#end/>
							<!-- <span id="errormsg" class="msg-box n-right" style="position:static;" for="j-loginName"></span> -->
							</td>
							<td><label for="j-deptId" class="control-label x85">部门：</label> <input type="text"
							name="deptName" value="$!deptMap[$!record.deptId]" size="15" id="j-deptId" width=600 height=400 data-toggle="lookup" data-url="$!{webPath}/tssy/tsSyDept/queryRecordByPageForLookUp"/>
						</td>
					</tr>
					<tr>
						<td><label for="j-email" class="control-label x85">邮箱：</label> <input type="text" maxlength="50"
							 name="email" value="$!record.email" size="15" id="j-email" /></td>
	<td><label for="j-mobile" class="control-label x85">联系电话：</label> <input type="text" maxlength="13"
							name="mobile" aria-required="true"  value="$!record.mobile" size="15" id="j-mobile" />
						</td>
					</tr>
					<tr>
						<td><label for="j-birthDate" class="control-label x85">生日：</label> <input type="text"
							name="birthDate" 
							value="$!dateTool.format('yyyy-MM-dd',$!record.birthDate)"
							data-toggle="datepicker" size="15" id="j-birthDate" /></td>
							<td><label for="j-remark" class="control-label x85">备注：</label> <input type="text"
							name="remark" value="$!record.remark" size="15" id="j-remark"/>
						</td>
						<!-- <td><label for="j-isDel" class="control-label x85">是否删除：</label> <input type="radio"
							class="form-control" #if($!$!record.isDel&&$$!record.isDel==
							'Y')checked#end name="isDel" id="jw-del" value="T" /><label
							for="jw-del">&nbsp;是</label> <input type="radio"
							class="form-control" #if($!$!record.isDel&&$$!record.isDel==
							'N')checked#end name="isDel" id="jw-nodel" value="F" /><label
							for="jw-nodel">&nbsp;否</label></td> -->
					</tr>
					<!--<tr>
						 <td><label for="j-isEnable" class="control-label x85">是否启用：</label> <input type="radio"
							class="form-control" #if($!record.isEnable&&$record.isEnable==
							'Y')checked#end name="isEnable" id="jw-enable" value="T" /><label
							for="jw-enable">&nbsp;是</label> <input type="radio"
							class="form-control" #if($!record.isEnable&&$record.isEnable==
							'N')checked#end name="isEnable" id="jw-disable" value="F" /><label
							for="jw-disable">&nbsp;否</label> 
						
					</tr>-->
				</tbody>
			</table>
		</form>
</div>
<div class="bjui-pageFooter">
	<ul>
		<li><button type="button" class="btn-close" data-icon="close">取消</button></li>
		<li><button type="submit" class="btn-default" data-icon="save">保存</button></li>
	</ul>
</div>
<script type="text/javascript">

$.CurrentDialog.find('#tsSyUserAddForm').validator({
    rules: {
        //自定义一个规则，用来代替remote（注意：要把$.ajax()返回出来）
        myRemote: function(element){
        	var msg = "";
             $.ajax({
                url: '$!{webPath}/tssy/tsSyUser/existLoginName',
                type: 'post',
                data: element.name +'='+ element.value,
                dataType: 'json',
                async:false,
                success: function(d){
                	if(d.error){
                		msg = d.error;
                	}
                }
            });
             return msg;
        }
    },
    fields: {
    	#if($!{record.id})
        loginName: 'required;loginName;',
        #else
        loginName: 'required;loginName;myRemote;',
        #end
        realName:'required',
        sex:'checked',
        deptName:'required',
        email:'required;email',
        mobile:'required;mobile',
        birthDate:"date"
    },  
    // 表单验证通过后，ajax提交
    valid: function(form){
    	
    }
});
</script>